import { canUseDom } from './can-use-dom'

const userAgent = navigator.userAgent.toLowerCase()

const generateDevice = (fn: () => boolean) => (canUseDom ? fn() : false)

export const isIos = generateDevice(() => /ios|iphone|ipad|ipod/.test(userAgent))

export const isFirefox = generateDevice(() => /firefox/.test(userAgent))
